home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / patches / itf201.lha / Infocom / DataFile.txt next >
Text File  |  1995-11-26  |  10KB  |  294 lines

  1. The InfoTaskForce Guide to the Infocom Data File Structure
  2. ==========================================================
  3. Copyright (c) 1992 InfoTaskForce
  4.  
  5.  
  6. Type 3 (Standard) Data File.
  7. ----------------------------
  8.  
  9.  
  10. From:    start_of_data_file
  11. To:    size of header - 1
  12. Data:    Header.
  13.  
  14. From:    size of header
  15. To:    common_word_ptr - 1
  16. Data:    Common Word Table.
  17.  
  18. From:    common_word_ptr
  19. To:    common_word_ptr + ( 3 * 32 * 2 ) ~ ( object_list - 1 )
  20. Data:    Common Word Table Index.
  21.     This table consists of 3 banks of 32 entries - each entry consists
  22.     of a 2 byte page/offset combination giving the start of the "common
  23.     word" within the data file. This should be a location in the Common 
  24.     Word Table.
  25.  
  26. From:    object_list
  27. To:    object_list + global_prop_size - 1
  28.     Global Property Table.
  29.  
  30. From:    object_list + global_prop_size
  31. To:    prop_ptr of Object 1 - 1
  32.     Object / Room List.
  33.     This starts with Object 0 which is all zeros. Object 1 is actually
  34.     the first object.
  35.  
  36. From:    prop_ptr of Object 1
  37. To:    global_vars - 1
  38. Data:    Object's Property Lists.
  39.     Properties within each Object's Propertry List are arranged in
  40.     descending order. If a property cannot be found in this list, it is
  41.     assumed to be in the Global Property Table.
  42.  
  43. From:    global_vars
  44. To:    input_word_buffer - 1
  45.     Global Variable Table.
  46.  
  47.     Variable 0        = Current Stack Entry.
  48.     Variable 1 - 15   = Local Variables on Z-Machine's Stack.
  49.     Variable 16 - 255 = two byte entries in this table.
  50.                 Note that there may be up to 255 variables. Thus
  51.                 this table may contain upto 240 entries ($1E0
  52.                 bytes).
  53.     Variable 16 = Current Location.
  54.     Variable 17 = Score / Hour.
  55.     Variable 18 = No. Moves / Minutes.
  56.  
  57. From:    input_word_buffer
  58. To:    input_word_buffer + ( buffer_length *    2 ) - 1
  59.     ~ ( input_character_buffer - 1 )
  60. Data:    Input Routine's Word Buffer.
  61.     First byte of the buffer contains the buffer length in words
  62.     (including this byte).
  63.  
  64. From:    input_character_buffer
  65. To:    input_character_buffer + buffer_length - 1
  66. Data:    Input Routine's Character Buffer.
  67.     First byte of the buffer contains the buffer length in bytes
  68.     (including this byte).
  69.  
  70. From:    input_character_buffer + buffer_length
  71. To:    save_bytes - 1
  72. Data:    ???
  73.  
  74. From:    save_bytes
  75. To:    vocab_ptr - 1
  76. Data:    ???
  77.  
  78. From:    vocab_ptr
  79. To:    vocab_ptr
  80. Data:    Size of "End Of Sentence" (EOS) Character Table.
  81.  
  82. From:    vocab_ptr + 1
  83. To::    vocab_ptr + EOS Table Size
  84. Data:    "End Of Sentence" Character Table.
  85.  
  86. From:    vocab_ptr + EOS Table Size + 1
  87. To:    vocab_ptr + EOS Table Size + 1
  88. Data:    Size of each Vocabulary Table Entry.
  89.  
  90. From:    vocab_ptr + EOS Table Size + 2
  91. To:    vocab_ptr + EOS Table Size + 3
  92. Data:    Number of Vocabulary Table Entries.
  93.  
  94. From:    vocab_ptr + EOS Table Size + 4
  95. To:    resident_bytes - 1
  96. Data:    Vocabulary Table.
  97.     (vocab_ptr + EOS Table Size + 4 + ( Size of Vocab Entry * Number of
  98.     Entries )) * resident_bytes - 1.
  99.  
  100. From:    resident_bytes
  101. To:    end of data file
  102. Data:    Z-Code.
  103.  
  104.  
  105. Note:
  106. -----
  107.  
  108. *    For Type 1 Data Files, there is no Common Word Table or 
  109.     Common Word Table Index. In this case, object_list * size of 
  110.     header.
  111.  
  112. *    For Type 2 Data Files, the Common Word Table and Common 
  113.     Word Table Index are smaller than for Type 3 Data Files. There 
  114.     is only one bank of 32 entries in the Common Word Table Index. 
  115.     Here, ( common_word_ptr + ( 1 * 32 * 2 )) * ( object_list - 1 ).
  116.  
  117. *    For Types 1 - 3, global_prop_size = $35.
  118.     For Types 4 - 5, global_prop_size = $70.
  119.  
  120. *    The location of the input_word_buffer and the 
  121.     input_character_buffer can only be found by examining parameters 
  122.     passed to the input routine.
  123.  
  124.  
  125.  
  126.  
  127. The Infocom Data File Header.
  128. -----------------------------
  129.  
  130. /*
  131. **    Infocom Game Header Structure.
  132. */
  133.  
  134. struct    header
  135. {
  136.     byte    z_code_version ;    /* Game's Z-CODE Version Number      */
  137.     byte    mode_bits ;        /* Status Bar display indicator      */
  138.     word    release ;        /* Game Release Number               */
  139.     word    resident_bytes ;    /* No. bytes in the Resident Area    */
  140.     word    start ;            /* Offset to Start of Game           */
  141.     word    vocab ;            /* Offset to VocabtList              */
  142.     word    object_list ;        /* Offset to Object/Room List        */
  143.     word    globals ;        /* Offset to Global Variables        */
  144.     word    save_bytes ;        /* No. bytes in the Save Game Area   */
  145.     word    script_status ;        /* Z-CODE printing modes             */
  146.     char    serial_no[6] ;        /* Game's Serial Number              */
  147.     word    common_word ;        /* Offset to Common Word List        */
  148.     word    verify_length ;        /* No. words in the Game File        */
  149.     word    verify_checksum ;    /* Game Checksum - used by Verify    */
  150.     byte    interpreter_number ;    /* Number - Set by Interpreter       */
  151.     byte    interpreter_version ;    /* ASCII Char - Set by Interpreter   */
  152.     byte    screen_height ;        /* Screen Height - Set by Interpreter*/
  153.     byte    screen_width ;        /* Screen Width  - Set by Interpreter*/
  154.     byte    left ;            /* Left Coord. - Set by Interpreter  */
  155.     byte    right ;            /* Right Coord. - Set by Interpreter */
  156.     byte    top ;            /* Top Coord. - Set by Interpreter   */
  157.     byte    bottom ;        /* Bottom Coord. - Set by Interpreter*/
  158.     byte    max_char_width ;    /* Max. Char. Width - Set by Interp. */
  159.     byte    max_char_height ;    /* Max. Char. Height - Set by Interp.*/
  160.     word    padding1[3] ;        /* Blank                 */
  161.     word    function_keys ;        /* Offset to Function Keys         */
  162.     word    padding2[2] ;        /* Blank                 */
  163.     word    alternate_alphabet ;    /* Offset to Alternate Alphabet         */
  164.     word    mouse_position ;    /* Offset to Mouse Position         */
  165.     word    padding3[4] ;        /* Blank                 */
  166. } ;
  167.  
  168. /*
  169. **    Header Information.
  170. **
  171. **    The 'z_code_version' byte has the following meaning:
  172. **        $00 : Not Used
  173. **        $01 : Game compiled for an early version of the interpreter
  174. **        $02 : Game compiled for an early version of the interpreter
  175. **        $03 : Game compiled for the current 'Standard Series Interp'
  176. **        $04 : Game compiled for the current 'Plus Series Interpreter'
  177. **        $05 : Game compiled for the current 'Advanced Series Interp'
  178. **        $06 : Game compiled for the current 'Graphics Series Interp'
  179. **
  180. **    The 'mode_bits' byte performs the following functions:
  181. **        Bit 0 :    Clear    - Standard: Game Data Normal.
  182. **            Set    - Standard: Game Data Byte Swapped.
  183. **            Clear    - Advanced: No Colour.
  184. **            Set    - Advanced: Colour.
  185. **        Bit 1 :    Clear    - Status Bar displays the SCORE.
  186. **            Set    - Status Bar displays the TIME.
  187. **        Bit 2 : Clear    - Plus: Boldface not Available.
  188. **            Set    - Plus: Boldface Available.
  189. **        Bit 3 :    Clear    - Standard: Normal.
  190. **            Set    - Standard: "Licensed to Tandy Corp" Flag.
  191. **            Clear    - Plus: Capitalise instead of Underline.
  192. **            Set    - Plus: Has Underline Capability.
  193. **        Bit 4 :    Clear    - Standard: Status Bar Available.
  194. **            Set    - Standard: Status Bar not Available.
  195. **            Clear    - Plus: No Fixed Space Font.
  196. **            Set    - Plus: Fixed Space Font Available.
  197. **        Bit 5 :    Clear    - Split Screens not Available.
  198. **            Set    - Split Screens Available.
  199. **        Bit 6 :    Clear    - Standard: No Proportional Font.
  200. **            Set    - Standard: Proportional Font is Default.
  201. **        Bit 7 : Clear    -
  202. **            Set    -
  203. **
  204. **    The 'script_status' word is used by Z-CODE to set printing modes
  205. **    for use by the interpreter:
  206. **        Bit  0 : Clear    - Script mode off.
  207. **             Set    - Script mode on.
  208. **        Bit  1 : Clear    - Use any type of Font.
  209. **             Set    - Use a Non-Proportional Font only.
  210. **        Bit  2 : Clear    - Normal.
  211. **             Set    - Status Line needs Redrawing.
  212. **        Bit  3 : Clear  - Advanced: No Graphics.
  213. **             Set    - Advanced: Graphics Available.
  214. **        Bit  4 : Clear    - Standard: No Sound.
  215. **             Set    - Standard: Sound Available.
  216. **             Clear    - Advanced: No Undo.
  217. **             Set    - Advanced: Undo Available.
  218. **        Bit  5 : Clear    - Advanced: No Mouse.
  219. **             Set    - Advanced: Mouse Available.
  220. **        Bit  6 : Clear    - Advanced: No Colour.
  221. **             Set    - Advanced: Colour Available.
  222. **        Bit  7 : Clear    - Advanced: No Sound.
  223. **             Set    - Advanced: Sound Available.
  224. **        Bit 10 : Clear    - Printer OK.
  225. **             Set    - Printer Error (e.g.: Not Connected ).
  226. */
  227.  
  228. /*
  229. **    "mode_bits" Bit Definitions:
  230. */
  231.  
  232. #define        GAME_DATA_NORMAL    ((byte)0xFE)
  233. #define        GAME_DATA_SWAPPED    ((byte)0x01)
  234. #define        NO_COLOUR        ((byte)0xFE)
  235. #define        USE_COLOUR        ((byte)0x01)
  236. #define        USE_SCORE        ((byte)0xFD)
  237. #define        USE_TIME        ((byte)0x02)
  238. #define        NO_BOLDFACE        ((byte)0xFB)
  239. #define        BOLDFACE        ((byte)0x04)
  240. #define        NON_TANDY        ((byte)0xF7)
  241. #define        TANDY            ((byte)0x08)
  242. #define        CAPITALISE        ((byte)0xF7)
  243. #define        UNDERLINE        ((byte)0x08)
  244. #define        STATUS_LINE        ((byte)0xEF)
  245. #define        NO_STATUS_LINE        ((byte)0x10)
  246. #define        NO_FIXED_FONT        ((byte)0xEF)
  247. #define        FIXED_FONT        ((byte)0x10)
  248. #define        NO_SCREEN_MODES        ((byte)0xDF)
  249. #define        SCREEN_MODES        ((byte)0x20)
  250. #define        NO_PROPORTIONAL_FONT    ((byte)0xBF)
  251. #define        PROPORTIONAL_FONT    ((byte)0x40)
  252.  
  253. /*
  254. **    "script_status" Bit Definitions:
  255. */
  256.  
  257. #define        SCRIPT_MODE_OFF        ((word)0xFFFE)
  258. #define        SCRIPT_MODE_ON        ((word)0x0001)
  259. #define        USE_ANY_FONT        ((word)0xFFFD)
  260. #define        USE_NON_PROP_FONT    ((word)0x0002)
  261. #define        NO_REFRESH        ((word)0xFFFB)
  262. #define        REFRESH            ((word)0x0004)
  263. #define        VERSION_5_NO_GRAPHICS    ((word)0xFFF7)
  264. #define        VERSION_5_GRAPHICS    ((word)0x0008)
  265. #define        VERSION_3_NO_SOUND    ((word)0xFFEF)
  266. #define        VERSION_3_SOUND        ((word)0x0010)
  267. #define        VERSION_5_NO_UNDO    ((word)0xFFEF)
  268. #define        VERSION_5_UNDO        ((word)0x0010)
  269. #define        VERSION_5_NO_MOUSE    ((word)0xFFDF)
  270. #define        VERSION_5_MOUSE        ((word)0x0020)
  271. #define        VERSION_5_NO_COLOUR    ((word)0xFFBF)
  272. #define        VERSION_5_COLOUR    ((word)0x0040)
  273. #define        VERSION_5_NO_SOUND    ((word)0xFF7F)
  274. #define        VERSION_5_SOUND        ((word)0x0080)
  275. #define        SCRIPT_OK        ((word)0xFBFF)
  276. #define        SCRIPT_ERROR        ((word)0x0400)
  277.  
  278. /*
  279. **    "interpreter_number" Byte Definitions:
  280. */
  281.  
  282. #define        XZIP            ((byte)0x00)
  283. #define        DEC_20            ((byte)0x01)
  284. #define        APPLE_2E        ((byte)0x02)
  285. #define        MACINTOSH        ((byte)0x03)
  286. #define        AMIGA            ((byte)0x04)
  287. #define        ATARI_ST        ((byte)0x05)
  288. #define        IBM_MSDOS        ((byte)0x06)
  289. #define        COMMODORE_128        ((byte)0x07)
  290. #define        C64            ((byte)0x08)
  291. #define        APPLE_2C        ((byte)0x09)
  292. #define        APPLE_2GS        ((byte)0x0A)
  293. #define        TANDY_COLOR        ((byte)0x0B)
  294.